<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<script type="text/javascript" src="../js/angular.min.js"></script>
		<script type="text/javascript">
			//初始化myapp 模块
			var myapp = angular.module("myapp",[]);
			//定义模块的控制器
			//依赖注入,$scope作用域对象，操作当前作用域试图
			myapp.controller("myctrl",function($scope){
				$scope.products = [
					{
						id:1001,
						name:'数码相机',
						price:1000
					},
					{
						id:1002,
						name:'手机',
						price:4000
					}
				];
			})
			
		</script>
	</head>
	<body>
		<!--ng-app="myapp" 定义了一个模块-->
		<div ng-app="myapp" ng-controller="myctrl">
			<table width="100%" border="1">
				<tr>
					<th>序号</th>
					<th>商品编号</th>
					<th>商品名称</th>
					<th>价格</th>
				</tr>
				<tr ng-repeat="product in products">
					<th>{{$index+1}}</th>
					<th>{{product.id}}</th>
					<th>{{product.name}}</th>
					<th>{{product.price}}</th>
				</tr>
			</table>
			
		</div>
	</body>
</html>
